<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>多个事件添加器</title>
</head>

<body>
    <div class="container">clicked me</div>
    <script>
        const addMultipleListeners = (el, eventType, listener, options) => (
            eventType.forEach(type => el?.addEventListener(type, listener, options))
        );
        addMultipleListeners(
        document.querySelector('.container'),
        ['click', 'mousedown'],
        () => { alert('hello!') }
    );
    </script>
</body>

</html>